<?php
/**
 * Description of index.php
 *
 * Optional URL format:
 * index.php?root=1&depth=1&title=CEO and Direct Reports
 *
 * Parameter descriptions:
 * root: id of employee at the top of the chart
 * depth: # of levels the chart should display
 * title: Title of the chart
 *
 * Ivan Bliskavka
 */

    // Do not cache this page. You might turn this off in production.
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header("Cache-Control: no-cache");
    header("Pragma: no-cache");

    include 'lib/chartConfig.php';
    include 'lib/orgChart.php';

    //Configuration settings are used in orgChart and chartNode.
    $GLOBALS["config"] = openConfig();

    //Default values
    $root = $GLOBALS['config']->root;
    $depth = $GLOBALS['config']->depth;
    $title = $GLOBALS['config']->title;

    //Values set by URL
    if(isset($_GET['root'])) $root = $_GET['root'];
    if(isset($_GET['depth'])) $depth = $_GET['depth'];
    if(isset($_GET['title'])) $title = $_GET['title'];

    $chart = new orgChart($root, $depth, $title);
    $chart->displayChart();
    /*if($_GET['report'] != 'disconnected'){
        $chart->displayChart();
    }
    else
    {
        $chart->displayDisconnected();
    }*/
?>
